package com.wm.task.common.util;

public class IDCreator {
    //private static Integer lastId = 0;
    private static final String ID_PATH = "id.data";

    public static Integer getId() {
        String result = FileHelper.readFile(ID_PATH);
        Integer id = 0;
        if (!result.isEmpty()) {
            //有id
            id = Integer.parseInt(result);
        }
        id++;
        FileHelper.writeFile(ID_PATH, id.toString(), false);
        return id;
    }
}
